/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

@import '../../../../variables';
@import '../../../../blueprint-overrides/common/colors';

.preview-table {
  position: relative;

  .ReactTable {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
    font-feature-settings: tnum;
    font-variant-numeric: tabular-nums;

    .rt-thead.-header {
      box-shadow: 0 1px 0 0 rgba(black, 0.2); // This is a hack! this line is sometimes too weak in tables.

      .rt-th {
        &.selected::after {
          position: absolute;
          top: 0;
          bottom: 0;
          left: 0;
          right: 0;
          content: '';
          border: 2px solid $blue4;
          border-radius: $pt-border-radius;
          pointer-events: none;
        }

        &.timestamp {
          background: rgba($cobalt3, 0.44);
        }

        &.dimension {
          background: rgba($green3, 0.3);

          &.bigint,
          &.float,
          &.double {
            background: rgba($blue3, 0.3);
          }

          &.array {
            background: rgba($orange2, 0.3);
          }

          &.multi-value {
            background: rgba($orange4, 0.3);
          }
        }

        &.metric {
          background: rgba($rose2, 0.16);
        }

        &.first-metric {
          border-left: 2px solid rgba(194, 39, 98, 0.7);
        }

        .header-wrapper {
          padding: $table-cell-v-padding $table-cell-h-padding;
          cursor: pointer;
          height: 55px;
        }

        .output-name {
          overflow: hidden;
          text-overflow: ellipsis;

          > * {
            display: inline-block;
            vertical-align: top;
          }

          .type-icon {
            margin-top: 3px;
            margin-right: 5px;
          }

          .filter-icon {
            margin-top: 2px;
            margin-left: 3px;
          }
        }

        .formula {
          font-family: monospace;
          font-size: 11px;
          margin-top: 4px;
          overflow: hidden;
          text-overflow: ellipsis;
        }
      }
    }

    .rt-td {
      cursor: pointer;

      &.timestamp {
        background: rgba($cobalt3, 0.16);
      }

      &.dimension {
        background: rgba($green3, 0.12);

        &.bigint,
        &.float,
        &.double {
          background: rgba($blue3, 0.1);
        }

        &.array {
          background: rgba($orange2, 0.1);
        }

        &.multi-value {
          background: rgba($orange4, 0.1);
        }
      }

      &.metric {
        background: rgba($rose2, 0.07);
      }

      &.first-metric {
        border-left: 2px solid rgba(194, 39, 98, 0.7);
      }
    }
  }

  .clickable-cell {
    cursor: pointer;
    width: 100%;
  }

  .#{$bp-ns}-popover2-target {
    width: 100%;
  }

  .aggregate-column {
    background-color: rgba($druid-brand, 0.06);
  }
}
